/** 
* @param {array}
* @param {function}
* @returns {number}
**/
function findIndex(array, callback) {
  if (!Array.isArray(array)) return
  const len = array.length
  let i = -1

  while(++i < len) {
    if (callback(array[i], i, array)) {
      return i
    }
  }
  return -1
}

export default findIndex